package cn.bbs.controller;

import cn.bbs.pojo.BbsDetail;
import cn.bbs.pojo.BbsSort;
import cn.bbs.service.BbsService;
import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.fastjson.JSON;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class BbsController {
    @Reference
    private BbsService bbsService;

    @RequestMapping("/getBbsListBySortId.do")
    public String getBbsListBySortId(Integer sortId){
        List<BbsDetail> list=bbsService.getBbsListBySortId(sortId);
        return JSON.toJSONString(list);
    }

    @RequestMapping("/getBbsSortList.do")
    public String getBbsSortList(){
        List<BbsSort> list=bbsService.getBbsSortList();
        return JSON.toJSONString(list);
    }
}
